Chris Pollett > Old Classes > CS174
( Print View )

Student Corner:
  [Submit Sec1]
  [Grades Sec1]

  [
Lecture Notes]
  [Discussion Board]

Course Info:
  [Texts & Links]
  [Description]
  [Course Outcomes]
  [Outcomes Matrix]
  [Course Schedule]
  [Grading]
  [Requirements/HW/Quizzes]
  [Class Protocols]
  [Exam Info]
  [Regrades]
  [University Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]  [Quizzes]

Practice Exams:
  [Midterm]  [Final]

                           












HW#5 --- last modified February 06 2019 04:05:23..

Solution set.

Due date: May 15

Files to be submitted:
  Hw5.zip

Purpose: To gain experience with Node.js and express server-side programming. To experiment with using Stripe for credit card processing.

Related Course Outcomes:

The main course outcomes covered by this assignment are:

CLO3 -- Write server-side scripts that process HTML forms.

CLO4 -- Write client-side scripts that validate HTML forms.

CLO5 -- Develop and deploy web applications that involve components, web services, and databases.

Specification:

For this homework you are going to create an application Not-Dead-Yet, using Node.js and Express.js, and if you want, Angular.js. The intent is to allow user's to send their loved ones a message, if they die. It's a paid service which periodically sends an email message to customer with a link in it. The customer has a certain time to click on the link. If they don't click on the link within the time period, emails are sent to a list of people notifying them that the customer has not checked-in. Here are some mock-ups of what pages on your site should look like:

Not-Dead-Yet...

...But letting people know when the time comes.

:

:

:

:

: /

Your card will be charged when you click the button below. A link will be mailed to you periodically that allows you to specify a message and who to send it to if you fail to check in

Landing Page.

Not-Dead-Yet...

...But time to check-in: some_user@somewhere.com

Your last check-in was: Saturday, 28-Jan-2017 11:45:47 PST.

:

Let-Know List:

Check-In Page.

 

Below are mock-ups of the Check-In Email and Notify Let-Know List Email.

Check-In Email
==============

Not-Dead-Yet...Time to Check-in!

Dear some_user@somewhere.com:

Please click the link below or copy it into your browser to check-in 
with us and update your notify list.

check_in_url

Best regards,
Not-Dead-Yet Team

Notify Let-Know List Email
==========================

Dear to_notify_person@notify-place.com:

some_user@somewhere.com has not checked-in with us during their
check-in period. We are sending you the message below that was
requested to be sent by some_user@somewhere.com if this happened.

...Message that some_user@somewhere.com left...

Best regards,
Not-Dead-Yet Team

  1. Your Hw5.zip folder has a readme.txt file with all the names and ids for your group. Instructions to the grader should also be in this file. Any configurations changes that the graders needs to do to get your project running on the grader's system should be settable in a file Hw5/Config.js.
  2. Your Config.js file should also have three configurable properties: check_in_frequency, which controls how frequently users need to check in, measured in milliseconds, and notify_delay, which determines the minimum time in milliseconds after a failed check-in before a user's Let-Know List is emailed, and email_job_frequency, which controls how often the callback to send out a batch of emails is called.
  3. The grader can use the line node CreateDB.js to create your mysql database.
  4. Your program starts from the command line using:
    node app.js
    //or
    node bin/www
    
    and the grader will expect to see your landing page at http://localhost:3000/
  5. On both the Landing and Check-in page h1 tag links to the landing page.
  6. The database has a table USER(ID, EMAIL, LAST_CHECK_IN, LAST_EMAIL_SENT, NOTIFY_LIST, MESSAGE).
  7. LAST_CHECK_IN, LAST_EMAIL_SENT are Unix timestamps which are initially 0.
  8. Whenever an email is sent related to a given user, that user's LAST_EMAIL_SENT column is updated to the current time.
  9. Whenever a user checks in, their user row is appropriately updated and the LAST_CHECK_IN time is updated.
  10. Your app uses setInterval or setTimeout (if you want to ensure emailJob completes, then schedules the next emailJob) to call a function emailJob (you can put this function in a module to make it cleaner, if you like) every email_job_frequency milliseconds. Only the emailJob function sends emails.
  11. emailJob can use an npm package like nodemailer or emailjs to send emails. If a user name and password are needed for the outgoing mail server, the grader should be able to configure the values in Config.js.
  12. emailJob uses queries to check for all user whose LAST_CHECK_IN, LAST_EMAIL_SENT are both 0, and send them an initial Check-In Email.
  13. emailJob gets all users such that LAST_CHECK_IN < LAST_EMAIL_SENT and (current time - LAST_EMAIL_SENT) > notify_delay and send each person on in their NOTIFY_LIST column the appropriate Notify Let-Know List Email.
  14. emailJob gets all users such that LAST_EMAIL_SENT < LAST_CHECK_IN and (current time - LAST_CHECK_IN) > check_in_frequency and send these users the appropriate Check-In Email.
  15. Client-side Javascript is used to validate form data for both the landing page and check-in page before forms (for example, perform sanity checks on the credit card number) are submitted.
  16. Credit charges are made using Stripe. The grader should be able to test using the test card numbers at https://stripe.com/docs/testing#cards. The Stripe charge amount should always be fixed at $5. Stripe API keys should be configured in there as well. DO NOT give the grader your live keys. You can leave test keys, but assume the grader will add their own. The readme.txt file should say if there is anything weird the grader needs to do to set this up.
  17. If the credit card transaction is not approved an error message is given and no row is added to the USER table, otherwise, if it is approved a row is added to the user table.
  18. Your program does not store credit card information, this should be leftto the Stripe people.
  19. When the Check-In form is successfully submitted, the user sees a message on the screen (make WAI-ARIA compliant), but remain on the Check-In Page. The Your last check-in was: paragraph element is updated.
  20. Your express app outputs useful console log messages when the emailJob runs, someone checks-in, or someone pays on the landing page.

Point Breakdown

Items (a)-(t) are each worth (1/2pt). 10pts
Total10pts